package com.mybatis.controller;

import com.mybatis.bean.Employee;
import com.mybatis.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class EmployeeController {
    @Autowired
    private EmployeeService employeeService;

    @RequestMapping("/getEmps")
    public String getListByLastName(HttpServletRequest request){
        String lastName=request.getParameter("lastName");
        List<Employee> employees=employeeService.getListByLastName(lastName);
        request.setAttribute("employees",employees);
        return "list";
    }

}
